package com.imooc.mymall.domain.common;

import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <h1>通用分页查询对象</h1>
 * @Author: crowsjian
 * @Date: 2020/7/11 22:09
 */
@Data
public class PageQuery<T> implements Serializable {

    private static final long serialVersionUID = 6701995154246252304L;

    /*当前页*/
    @NotNull(message = "页号不能为空！")
    @Min(value=1,message = "页号必须为正数！")
    private Integer pageNo = 1;
    /*每页条数*/
    @NotNull(message = "每页条数不能为空！")
    @Max(value = 100,message = "每页条数不能超过100条！")
    private Integer pageSize = 20;
    /*动态查询条件 @Valid 级联校验*/
    @Valid
    @NotNull(message = "动态查询条件不能为空！")
    private T query;

}
